<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../jquery/jquery-1.9.1.min.js"></script>
<script src="../jquery/js/jquery-ui-1.10.3.custom.js"></script>
<link href="../jquery/css/cupertino/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<link rel="stylesheet" href="../jquery/themes/base/jquery.ui.all.css">
<script src="../jquery/ui/jquery.ui.core.js"></script>
<script src="../jquery/ui/jquery.ui.widget.js"></script>
<script src="../jquery/ui/jquery.ui.position.js"></script>
<script src="../jquery/ui/jquery.ui.menu.js"></script>
<script src="../jquery/ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="css/demos.css">
<script type="text/javascript">
$(function(){
	$.fn.outerText=function(){
		return $('<div/>').append(this.clone()).html();
	};
	jQuery.fn.outerHTML=function(s){
		return (s)?this.before(s).remove():jQuery("&lt;p&gt;").append(this.eq(0).clone()).html();
	};
	$('#getOuterHTML').change(function(){
		$("#div-log").html($("#div-log").html()+$('#id-outerHTML').outerText());
	});
	$('#setOuterHTML').change(function(){
		$('#id-outerHTML').outerHTML('<select name="id-outerHTML" id="id-outerHTML"><option value="1" selected="selected">outerHTML</option><option value="2">outerHTML</option><option value="3">outerHTML</option></select>');
	});
});
</script>
<style type="text/css">
body {
	font:62.5% "Trebuchet MS", sans-serif;
	margin:64px;
}
#h2-caption {
	font:20px "Trebuchet MS", sans-serif;
}
p {
	font:16px "Trebuchet MS", sans-serif;
}
.demoHeaders {
	margin-top:2em;
}
form {
	font:16px "Trebuchet MS", sans-serif;
}
#div-log {
	font:13.5px "Trebuchet MS", sans-serif;
}
</style>
<title>超实用的jQuery代码段</title>
</head>
<body>
	<h2 id="h2-caption">超实用的jQuery代码段 - jQuery实现outerHTML</h2>
	<hr><br>
	<select name="getOuterHTML" id="getOuterHTML">
		<option value="1">getOuterHTML</option>
		<option value="2">getOuterHTML</option>
		<option value="3">getOuterHTML</option>
	</select>
	<select name="setOuterHTML" id="setOuterHTML">
		<option value="1">setOuterHTML</option>
		<option value="2">setOuterHTML</option>
		<option value="3">setOuterHTML</option>
	</select>
	<div id="id-outerHTML">
		<p>jQuery实现outerHTML</p>
	</div>
	<br><hr>
	<div id="div-log">
		<p>日志记录：</p>
	</div>
</body>
</html>